<template>
  <div>
	  <button type="button" @click="show=true">显示弹出层</button>
	  <teleport to="#hello">
		  <div v-if="show" class="modal">
			  <div class="box">
				  我是modal里的内容
			  </div>
		  </div>
	  </teleport>
	  <teleport to="#hello">
		  <p>测试代码</p>
	  </teleport>
  </div>
</template>

<script lang="ts">
import { defineComponent } from 'vue'
export default defineComponent({
  name: 'Test',
  data(){
	  return {
		  show:false
	  }
  }
})
</script>

<style scoped>
.modal {
	position:absolute;
	left:0;
	right:0;
	top:0;
	bottom:0;
	background-color:rgba(0,0,0,0.7);
}
.modal .box {
		margin-top:30px;
		width:200px;
		height:100px;
		background-color:#fff;
	}
</style>
